﻿// Page2.cpp : implementation file
//

#include "stdafx.h"
#include "TOOLBOX4.h"
#include "Page2.h"
#include "PageShare.h"
#include "Report.h"
#include "GetHostAsset.h"

//#include "GetUsbRecord.h"
#include "GetSystemSetting.h"

#include "GetLogCollection.h"
#include "ParseWebResultFile.h"
int LogCount=0;
// CPage2

IMPLEMENT_DYNAMIC(CPage2, CWnd)

CPage2::CPage2():m_TimerID(0)
{
	m_Timer30ID = 0;
	CString modPath = GetModulePath().c_str();
	modPath += _T("\\");
	LoadImg(modPath+_T("res/background-new.png"), m_imgBackground);
	m_nBackWidth = m_imgBackground.GetWidth();
	m_nBackHeight = m_imgBackground.GetHeight();

	LoadImg(modPath+_T("res/fastIcon.png"), m_imgFastIcon);
	m_nFastIconWidth = m_imgFastIcon.GetWidth();
	m_nFastIconHeight = m_imgFastIcon.GetHeight();

	LoadImg(modPath+_T("res/fastlabel.png"), m_imgFastLabel);
	m_nFastLabelWidth = m_imgFastLabel.GetWidth();
	m_nFastLabelHeight = m_imgFastLabel.GetHeight();

	LoadImg(modPath+_T("res/logo.png"), m_imgLogo);
	m_nLogoWidth = m_imgLogo.GetWidth();
	m_nLogoHeight = m_imgLogo.GetHeight();

	nBRes.clear();
	
}

CPage2::~CPage2()
{
	//AfxMessageBox(_T("CPage2 析构函数调用"));
}

CPoint CPage2::m_LBDpoint = NULL;
CPoint CPage2::m_LBUpoint = NULL;

BOOL CPage2::m_bIsWEBFinish = FALSE;
BOOL CPage2::m_bIsNetWorkFinish = FALSE;
BOOL CPage2::m_bIsMemoryFinish = FALSE;
BOOL CPage2::m_bIsHardwareFinish = FALSE;
BOOL CPage2::m_bIsWirelessFinish = FALSE;
BOOL CPage2::m_bIsClipboardFinish  = FALSE;
BOOL CPage2::m_bIsHostLogFinish = FALSE;
BOOL CPage2::m_bIsAnalyzeFinish = FALSE;
BOOL CPage2::m_bIsFileOperationFinish = FALSE;
BOOL CPage2::m_bIsInterFinish = FALSE;
BOOL CPage2::m_bIsPortFinish = FALSE;
BOOL CPage2::m_bIsProcessFinish = FALSE;
BOOL CPage2::m_bIsServiceFinish = FALSE;
BOOL CPage2::m_bIsSoftWareFinish = FALSE;
BOOL CPage2::m_bIsAccountSecFinish = FALSE;
BOOL CPage2::m_bIsFileShareFinish = FALSE;
BOOL CPage2::m_bIsUSBFinish = FALSE;
BOOL CPage2::m_bIsARPFinish = FALSE;
BOOL CPage2::m_bIsUSNFinish = FALSE;
BOOL CPage2::m_bIsDNSFinish = FALSE;
BOOL CPage2::m_bIsLogPolicyFinish = FALSE;
BOOL CPage2::m_bIsPathInfoFinish = FALSE;
BOOL CPage2::m_bIsFileInfoFinish = FALSE;
BOOL CPage2::m_bIsHostBaseInfoFinish=FALSE;
BOOL CPage2::m_bIsStartUpInfoFinish=FALSE;
BOOL CPage2::m_bIsTaskInfoFinish=FALSE;
BOOL CPage2::m_bIsDBLogFinish=FALSE;
unsigned long CPage2::m_ulHostLogNum = 0;
unsigned long CPage2::m_ulSysPacthNum = 0;
unsigned long CPage2::m_ulFileTraceNum = 0;
unsigned long CPage2::m_ulNetTraceNum = 0;
unsigned long CPage2::m_ulPortNum = 0;
unsigned long CPage2::m_ulProcessNum = 0;
unsigned long CPage2::m_ulServiceNum = 0;
unsigned long CPage2::m_ulSoftWareNum = 0;
unsigned long CPage2::m_ulSecBaseLineNum = 0;
unsigned long CPage2::m_ulFileShareNum = 0;
unsigned long CPage2::m_ulUSBTraceNum = 0;
unsigned long CPage2::m_ulARPNum=0;
unsigned long CPage2::m_ulUSNNum=0;
unsigned long CPage2::m_ulDNSNum=0;
unsigned long CPage2::m_ulPathInfoNum=0;
unsigned long CPage2::m_ulFileInfoNum=0;
unsigned long CPage2::m_ulNetWorkNum = 0;
std::vector<POSAUTHSECBSA> CPage2::m_svAuthSec;
std::vector<POSACCOUNTSECBSA> CPage2::m_svAccountSec;
std::vector<POSSERVICESECBSA> CPage2::m_svSerivceSec;
std::vector<POSPASSWORDBSA> CPage2::m_svPassWdSec;
std::vector<POSNETACCCTRLBSA> CPage2::m_svNetSec;
std::vector<POSFILEACCCTRLSECBSA> CPage2::m_svFileSec;

CTOOLBOX4View * CPage2::m_pView = NULL;


HANDLE CPage2::m_hSoftWare_Fast;
HANDLE CPage2::m_hSecBaseLine_Fase;

BOOL CPage2::m_bIsRet = FALSE;

unsigned myMesgBoxThread(LPVOID lpvParam);

void CPage2::LoadBackGround(CDC * paintDC, CDC &memDC, CImage &img)
{
	HBITMAP hbitmap;
	if(img != NULL)
	{
		hbitmap = img.Detach();
	}
	
	CBitmap cBitmap;
	//CDC memDC;
	cBitmap.Attach(hbitmap);
	memDC.CreateCompatibleDC(paintDC);
	memDC.SelectObject(hbitmap);
	SetStretchBltMode(memDC.GetSafeHdc(),STRETCH_HALFTONE);
}


BEGIN_MESSAGE_MAP(CPage2, CWnd)
	ON_WM_PAINT()
	ON_WM_SIZE()
	ON_WM_CTLCOLOR()
	ON_WM_CREATE()
	ON_WM_LBUTTONDOWN()
	ON_WM_LBUTTONUP()
	ON_MESSAGE(WM_RETPROGRESS, &CPage2::OnRetprogress)
	ON_MESSAGE(WM_RETRESULT, &CPage2::OnRetresult)
	ON_WM_TIMER()
END_MESSAGE_MAP()



// CPage2 message handlers



void CPage2::OnPaint()
{
	CPaintDC dc(this); // device context for painting
	// TODO: Add your message handler code here
	// Do not call CWnd::OnPaint() for painting messages
	
	//CDC memDC;
	HDC hdc = dc.GetSafeHdc();

	m_pPageShare->ShowBackGround(hdc);
	m_imgFastIcon.Draw(hdc, 40, 110, m_nFastIconWidth, m_nFastIconHeight, 0, 0, m_nFastIconWidth, m_nFastIconHeight);
	m_imgFastLabel.Draw(hdc, 150, 110, m_nFastLabelWidth, m_nFastLabelHeight, 0, 0, m_nFastLabelWidth, m_nFastLabelHeight);
	m_pPageShare->ShowSeparation(hdc);
	m_pPageShare->ShowLogo(hdc);
	m_pPageShare->ShowCurrentBack(hdc);
	m_pPageShare->ShowStopBtn(hdc);
	if(m_bIsRet)
		m_pPageShare->SHowRetBtn(hdc);

	int height1 = 250;
	int height2 = 350;
	int height3 = 450;
	int height4 = 550;
	/*int height1 = 220;
	int height2 = 370;
	int height3 = 520;
	int height4 = 675;*/
	int cx = 50;

	m_pPageShare->ShowHostBaseInfo(m_bIsHostBaseInfoFinish, hdc, cx, height1);
	cx += 125;

	m_pPageShare->ShowNetWork(m_bIsNetWorkFinish, hdc, cx, height1);

	cx += 125;
	m_pPageShare->ShowMemory(m_bIsMemoryFinish, hdc, cx, height1);

	cx += 125;
	m_pPageShare->ShowPathInfo(m_bIsPathInfoFinish, hdc, cx, height1);

	cx += 125;
	m_pPageShare->ShowService(m_bIsServiceFinish, hdc, cx, height1);

	cx += 125;
	m_pPageShare->ShowProcess(m_bIsProcessFinish, hdc, cx, height1);

	cx += 125;
	m_pPageShare->ShowFileTrace(m_bIsFileOperationFinish, hdc, cx, height1);


	cx = 50;
	m_pPageShare->ShowPort(m_bIsPortFinish, hdc, cx, height2);

	cx += 125;
	m_pPageShare->ShowTaskInfo(m_bIsTaskInfoFinish, hdc, cx, height2);

	cx += 125;
	m_pPageShare->ShowStartUpInfo(m_bIsStartUpInfoFinish, hdc, cx, height2);

	cx += 125;
	m_pPageShare->ShowHardware(m_bIsHardwareFinish, hdc, cx, height2);

	cx += 125;
	m_pPageShare->ShowNetTrace(m_bIsInterFinish, hdc, cx, height2);

	cx += 125;
	m_pPageShare->ShowUSBTrace(m_bIsUSBFinish, hdc, cx, height2);

	cx += 125;
	m_pPageShare->ShowSoftWare(m_bIsSoftWareFinish, hdc, cx, height2);



	//2020.12.28
	cx = 50;
	m_pPageShare->ShowWireless(m_bIsWirelessFinish, hdc, cx, height3);

	cx += 125;
	m_pPageShare->ShowWebDetect(m_bIsWEBFinish, hdc, cx, height3);

	cx += 125;
	m_pPageShare->ShowDBLog(m_bIsDBLogFinish, hdc, cx, height3);

	cx += 125;
	m_pPageShare->ShowHostLog(m_bIsHostLogFinish, hdc, cx, height3);

	cx += 125;
	m_pPageShare->ShowUSN(m_bIsUSNFinish, hdc, cx, height3);

	cx += 125;
	m_pPageShare->ShowFileInfo(m_bIsFileInfoFinish, hdc, cx, height3);

	cx += 125;
	m_pPageShare->ShowFileShare(m_bIsFileShareFinish, hdc, cx, height3);

	cx = 50;
	m_pPageShare->ShowClipboard(m_bIsClipboardFinish, hdc, cx, height4);

	cx += 125;
	m_pPageShare->ShowAccountSec(m_bIsAccountSecFinish, hdc, cx, height4);

	cx += 125;
	m_pPageShare->ShowARP(m_bIsARPFinish, hdc, cx, height4);

	cx += 125;
	m_pPageShare->ShowDNS(m_bIsDNSFinish, hdc, cx, height4);

	cx += 125;
	m_pPageShare->ShowLogPolicyTrace(m_bIsLogPolicyFinish, hdc, cx, height4);

	cx += 125;
	m_pPageShare->ShowAnalyze(m_bIsAnalyzeFinish, hdc, cx, height4);
	

	m_pPageShare->m_stcWebFile->ShowWindow(SW_SHOW);
	m_pPageShare->m_stcNetWorkCard->ShowWindow(SW_SHOW);
	m_pPageShare->m_stcMemory->ShowWindow(SW_SHOW);
	m_pPageShare->m_stcHostLog->ShowWindow(SW_SHOW);
	m_pPageShare->m_stcAnalyze->ShowWindow(SW_SHOW);
	m_pPageShare->m_stcFileTrace->ShowWindow(SW_SHOW);
	m_pPageShare->m_stcNetTrace->ShowWindow(SW_SHOW);
	m_pPageShare->m_stcPort->ShowWindow(SW_SHOW);
	m_pPageShare->m_stcProcess->ShowWindow(SW_SHOW);
	m_pPageShare->m_stcService->ShowWindow(SW_SHOW);
	m_pPageShare->m_stcSoftWare->ShowWindow(SW_SHOW);
	m_pPageShare->m_stcAccountSec->ShowWindow(SW_SHOW);
	m_pPageShare->m_stcFileShare->ShowWindow(SW_SHOW);
	m_pPageShare->m_stcUSBTrace->ShowWindow(SW_SHOW);
	m_pPageShare->m_stcCurent->ShowWindow(SW_SHOW);
	m_pPageShare->m_stcExplain->ShowWindow(SW_SHOW);
	m_pPageShare->m_stcContent->ShowWindow(SW_SHOW);
	m_pPageShare->m_stcUSNTrace->ShowWindow(SW_SHOW);
	m_pPageShare->m_stcARPTrace->ShowWindow(SW_SHOW);
	m_pPageShare->m_stcDNSTrace->ShowWindow(SW_SHOW);
	m_pPageShare->m_stcLogPolicyTrace->ShowWindow(SW_SHOW);
	m_pPageShare->m_stcPathInfoTrace->ShowWindow(SW_SHOW);
	m_pPageShare->m_stcFileInfoTrace->ShowWindow(SW_SHOW);
	m_pPageShare->m_stcHostBaseInfoTrace->ShowWindow(SW_SHOW);
	m_pPageShare->m_stcStartUpInfoTrace->ShowWindow(SW_SHOW);
	m_pPageShare->m_stcTaskInfoTrace->ShowWindow(SW_SHOW);
	m_pPageShare->m_stcDBLogTrace->ShowWindow(SW_SHOW);
	m_pPageShare->m_stcHardware->ShowWindow(SW_SHOW);
	m_pPageShare->m_stcWireless->ShowWindow(SW_SHOW);
	m_pPageShare->m_stcClipboard->ShowWindow(SW_SHOW);
}


void CPage2::OnSize(UINT nType, int cx, int cy)
{
	CWnd::OnSize(nType, cx, cy);

	// TODO: Add your message handler code here
	//AfxMessageBox(_T("on size called"));
}

HBRUSH CPage2::OnCtlColor(CDC* pDC, CWnd* pWnd, UINT nCtlColor)
{
	HBRUSH hbr = CWnd::OnCtlColor(pDC, pWnd, nCtlColor);

	// TODO:  Change any attributes of the DC here
	switch(nCtlColor)
	{
	case CTLCOLOR_STATIC:
		{
			//if(pWnd->GetDlgCtrlID()== WEBFILESTATICID)
			//{
			//	pDC->SetBkMode(TRANSPARENT);
			//	return   (HBRUSH)::GetStockObject(NULL_BRUSH); 
			//}
			pDC->SetBkMode(TRANSPARENT);
			pDC->SetTextColor(RGB(255,255,255));
			return   (HBRUSH)::GetStockObject(NULL_BRUSH); 
		}
	default:
		return CWnd::OnCtlColor(pDC,   pWnd,   nCtlColor);
	}


	// TODO:  Return a different brush if the default is not desired
	//return hbr;
}


int CPage2::OnCreate(LPCREATESTRUCT lpCreateStruct)
{
	if (CWnd::OnCreate(lpCreateStruct) == -1)
		return -1;

	// TODO:  Add your specialized creation code here
	m_pPageShare = new CPageShare(this);
	m_pPageShare->Create(NULL, TEXT(""), WS_CHILD, CRect(0 ,0, 1000, 870), this, CPAGESHAREID);

	m_pResult = new CDisposeResult;

	return 0;
}


void CPage2::OnLButtonDown(UINT nFlags, CPoint point)
{
	// TODO: Add your message handler code here and/or call default
	GetCursorPos(&m_LBDpoint);

	CRect rect(0,0,1000,80);
	ClientToScreen(rect);
	if(rect.PtInRect(m_LBDpoint))
	{
		//使鼠标可以拖动窗口
		m_pView->GetParent()->SendMessage(WM_SYSCOMMAND,SC_MOVE|HTCAPTION,0);
	}

	CWnd::OnLButtonDown(nFlags, point);
}

void CPage2::OnLButtonUp(UINT nFlags, CPoint point)
{
	// TODO: Add your message handler code here and/or call default
	GetCursorPos(&m_LBUpoint);
	CRect rt_ret(m_pPageShare->m_rtRetBtn);
	CRect rt_stop(m_pPageShare->m_rtStopBtn);
	ClientToScreen(rt_ret);
	ClientToScreen(rt_stop);
	if(rt_stop.PtInRect(m_LBDpoint) && rt_stop.PtInRect(m_LBUpoint))
	{
		if(!m_bIsRet)
		{
			//m_bIsRet = TRUE;
			//Invalidate();
			CModule::m_bStop = TRUE;
			CString IniFile = CTOOLBOX4App::ms_strFullResultPath;
			IniFile += _T("OriginalCfg.ydini");
			SetIniFileKeyValue(IniFile.GetBuffer(), TEXT("IsStop"), TEXT("isStop"), _T("F_1"));

			HANDLE myThread = (HANDLE)_beginthreadex(nullptr, 0, (unsigned (__stdcall*)(void*))&myMesgBoxThread, this, 0, nullptr);
			// 如果 病毒扫描进程存活, 则杀死该进程
			CModule::KillVirusScanProc();
			TerminateProcess(m_hSoftWare_Fast, 35);
			TerminateProcess(m_hSecBaseLine_Fase, 36);
		}
	}

	if(rt_ret.PtInRect(m_LBDpoint) && rt_ret.PtInRect(m_LBUpoint)&& m_bIsRet)
	{
		CTOOLBOX4View::PAGE = 1;
		m_pView->SendMessage(WM_MY_PAGECHANGE);
	}

	//if()

	CWnd::OnLButtonUp(nFlags, point);
}

// 定时器线程
unsigned myTimer2Thread(LPVOID lpvParam)
{
	CPage2 *pPage2 = (CPage2 *)lpvParam;

	pPage2->m_TimerID = SetTimer(pPage2->m_hWnd, TIMER2ID, 1000, NULL);

	return 0;
}

// 定时器线程
unsigned myTimer9Thread(LPVOID lpvParam)
{
	CPage2 *pPage2 = (CPage2 *)lpvParam;

	pPage2->m_Timer2ID = SetTimer(pPage2->m_hWnd, TIMER81ID, 1000, NULL);

	return 0;
}

unsigned myTimer30Thread(LPVOID lpvParam)
{
	CPage2 *pPage2 = (CPage2 *)lpvParam;
	pPage2->m_Timer30ID = SetTimer(pPage2->m_hWnd, TIMERID30, 1000, NULL);
	return 0;
}


unsigned myMesgBoxThread(LPVOID lpvParam)
{
	CPage2 * page2 = (CPage2 *)lpvParam;
	MessageBox(page2->m_hWnd, _T("正在停止采集, 此过程可能需要一些时间, 请稍候!"), _T("请稍候!"), MB_ICONASTERISK|MB_OK);
	return 0;
}

void CPage2::SetCurrentText(CString text)
{
	m_pPageShare->m_stcCurent->SetWindowText(text);
	CRect rt;
	m_pPageShare->m_stcCurent->GetWindowRect(rt);
	ScreenToClient(rt);
	InvalidateRect(&rt);
}

void CPage2::SetContentText(PTASKPROGRESS prc)
{
	CString str(prc->pszText);
	m_pPageShare->m_stcContent->SetWindowText(str);
	CRect rt;
	m_pPageShare->m_stcContent->GetWindowRect(rt);
	ScreenToClient(rt);
	InvalidateRect(&rt);
}

void CPage2::InsertSecBaseLine(int SecType, sqlite3* pSql,CString name, CString ref, CString real, CString comp)
{
	//////////////安全基线结果入库sqlite3 /////////////////////

	//TCHAR * lTname = Tname;
	//TCHAR * lTref = Tref;
	//TCHAR * lTreal = Treal;
	//TCHAR * lTcomp = Tcomp;

	name.Replace(_T("\'"), _T("\'\'"));
	ref.Replace(_T("\'"), _T("\'\'"));
	real.Replace(_T("\'"), _T("\'\'"));
	comp.Replace(_T("\'"), _T("\'\'"));
	
	char *errMsg = NULL;
	int ret;
	CString guid = NewGUID();
	//char * cGuid = UnicodeToUtf8(guid);//
	//char sql[1024] = {0};
	CString strSql;
	strSql.Format(_T("insert into Sec_Base_Line values('%s', '%d', '%s', '%s', '%s', '%s', '%s', '%s', '')"), guid, SecType, name, ref, real, comp, CTOOLBOX4App::ms_strMacAddr, CModule::m_csEventTaskId);
	//sprintf(sql, "insert into Sec_Base_Line values('%s', '%d', '%s', '%s', '%s', '%s', '%s', '%s', '')", cGuid, SecType, UnicodeToUtf8(lTname), UnicodeToUtf8(lTref), UnicodeToUtf8(lTreal), UnicodeToUtf8(lTcomp), UnicodeToUtf8(CTOOLBOX4App::ms_strMacAddr), UnicodeToUtf8(CModule::m_csEventTaskId));
	char *sql = UnicodeToUtf8(strSql);
	ret = sqlite3_exec(pSql, sql, NULL, NULL, &errMsg);
	if(errMsg != NULL)
	{
		MessageBox(UTF82WCS(errMsg), _T("错误"), MB_ICONERROR);
		exit(-6);
	}
	sqlite3_free(errMsg);
	//delete []cGuid;
	delete []sql;
}

// 安装软件 结果入库
unsigned SoftWare_fast(LPVOID lpvParam)
{
	CPage2 *pThis = (CPage2 *)lpvParam;
	pThis->m_pResult->SoftWareInsertDb();
	return 0;
}

// 安全基线 结果入库
unsigned SecBaseLine_fast(LPVOID lpvParam)
{
	CPage2 *pThis = (CPage2 *)lpvParam;

	WaitForSingleObject(pThis->m_hSoftWare_Fast, INFINITE);

	int ret;
	sqlite3 * pSql;
	CString strDbName = CTOOLBOX4App::ms_strFullResultPath;
	strDbName += _T("主机层\\hongtan004.db");
	char * dbName = UnicodeToUtf8(strDbName);//
	ret = sqlite3_open(dbName, &pSql);
	if(ret != SQLITE_OK)
	{
		MessageBox(NULL, _T("打开数据库失败"), _T("错误"), MB_ICONERROR);
		exit(-5);
	}

	// 授权安全
	for(std::vector<POSAUTHSECBSA>::iterator it1 = pThis->m_svAuthSec.begin(); it1 != pThis->m_svAuthSec.end(); it1++)
	{
		pThis->InsertSecBaseLine(1, pSql, (*it1)->name, (*it1)->reference, (*it1)->real, (*it1)->compare);
	}
	// 账户安全
	for(std::vector<POSACCOUNTSECBSA>::iterator it2 = pThis->m_svAccountSec.begin(); it2 != pThis->m_svAccountSec.end(); it2++)
	{
		pThis->InsertSecBaseLine(2, pSql, (*it2)->name, (*it2)->reference, (*it2)->real, (*it2)->compare);
	}
	// 服务安全
	for(std::vector<POSSERVICESECBSA>::iterator it3 = pThis->m_svSerivceSec.begin(); it3 != pThis->m_svSerivceSec.end(); it3++)
	{
		pThis->InsertSecBaseLine(3, pSql, (*it3)->name, (*it3)->reference, (*it3)->real, (*it3)->compare);
	}
	// 口令安全
	for(std::vector<POSPASSWORDBSA>::iterator it4 = pThis->m_svPassWdSec.begin(); it4 != pThis->m_svPassWdSec.end(); it4++)
	{
		pThis->InsertSecBaseLine(4, pSql, (*it4)->name, (*it4)->reference, (*it4)->real, (*it4)->compare);
	}
	// 网络访问安全
	for(std::vector<POSNETACCCTRLBSA>::iterator it5 = pThis->m_svNetSec.begin(); it5 != pThis->m_svNetSec.end(); it5++)
	{
		pThis->InsertSecBaseLine(5, pSql, (*it5)->name, (*it5)->reference, (*it5)->real, (*it5)->compare);
	}
	// 文件访问安全
	for(std::vector<POSFILEACCCTRLSECBSA>::iterator it6 = pThis->m_svFileSec.begin(); it6 != pThis->m_svFileSec.end(); it6++)
	{
		pThis->InsertSecBaseLine(6, pSql, (*it6)->name, (*it6)->reference, (*it6)->real, (*it6)->compare);
	}
	sqlite3_close(pSql);
	delete []dbName;
	//清空容器
	for(std::vector<POSAUTHSECBSA>::iterator it1 = pThis->m_svAuthSec.begin(); it1 != pThis->m_svAuthSec.end(); it1++)
	{
		if(*it1 != NULL)
		{
			delete *it1;
			*it1 = NULL;
		}
	}
	pThis->m_svAuthSec.clear();
	std::vector<POSAUTHSECBSA>().swap(pThis->m_svAuthSec);
	for(std::vector<POSACCOUNTSECBSA>::iterator it2 = pThis->m_svAccountSec.begin(); it2 != pThis->m_svAccountSec.end(); it2++)
	{
		if(*it2 != NULL)
		{
			delete *it2;
			*it2 = NULL;
		}
	}
	pThis->m_svAccountSec.clear();
	std::vector<POSACCOUNTSECBSA>().swap(pThis->m_svAccountSec);
	for(std::vector<POSSERVICESECBSA>::iterator it3 = pThis->m_svSerivceSec.begin(); it3 != pThis->m_svSerivceSec.end(); it3++)
	{
		if(*it3 != NULL)
		{
			delete *it3;
			*it3 = NULL;
		}
	}
	pThis->m_svSerivceSec.clear();
	std::vector<POSSERVICESECBSA>().swap(pThis->m_svSerivceSec);
	for(std::vector<POSPASSWORDBSA>::iterator it4 = pThis->m_svPassWdSec.begin(); it4 != pThis->m_svPassWdSec.end(); it4++)
	{
		if(*it4 != NULL)
		{
			delete *it4;
			*it4 = NULL;
		}
	}
	pThis->m_svPassWdSec.clear();
	std::vector<POSPASSWORDBSA>().swap(pThis->m_svPassWdSec);
	for(std::vector<POSNETACCCTRLBSA>::iterator it5 = pThis->m_svNetSec.begin(); it5 != pThis->m_svNetSec.end(); it5++)
	{
		if(*it5 != NULL)
		{
			delete *it5;
			*it5 = NULL;
		}
	}
	pThis->m_svNetSec.clear();
	std::vector<POSNETACCCTRLBSA>().swap(pThis->m_svNetSec);
	for(std::vector<POSFILEACCCTRLSECBSA>::iterator it6 = pThis->m_svFileSec.begin(); it6 != pThis->m_svFileSec.end(); it6++)
	{
		if(*it6 != NULL)
		{
			delete *it6;
			*it6 = NULL;
		}
	}
	pThis->m_svFileSec.clear();
	std::vector<POSFILEACCCTRLSECBSA>().swap(pThis->m_svFileSec);
	//////////////安全基线结果入库sqlite3 /////////////////////
	sqlite3_close(pSql);
	return 0;
}

// 获取表中数据的条数, TableName:表名
CString GetTableCount(CString TableName)
{
	CString strCount = _T("0");
	sqlite3 * m_hSql;
	int ret;
	char ** dbResult = NULL;
	int nRow, nColumn;
	int i, j, index;
	char * errMsg = NULL;
	char *sql = NULL;
	CString csSql;
	csSql.Format(_T("select count(*) from %s"), TableName);

	TCHAR dbPath[MAX_PATH] = {0};
	_tcsncpy_s(dbPath, CTOOLBOX4App::ms_strFullResultPath.GetBuffer(), MAX_PATH);
	_tcscat_s(dbPath, _T("主机层\\hongtan004.db"));
	char *cDbPath = UnicodeToUtf8(dbPath);
	ret = sqlite3_open(cDbPath, &m_hSql);
	if(ret != SQLITE_OK)
	{
		MessageBox(NULL, _T("打开数据库失败!"), _T("错误"), MB_ICONERROR);
		if(cDbPath != NULL)
		{
			delete []cDbPath;
			cDbPath = NULL;
		}
	}
	else
	{
		char *sql = UnicodeToUtf8(csSql);
		ret = sqlite3_get_table(m_hSql, sql, &dbResult, &nRow, &nColumn, &errMsg);
		if(ret == SQLITE_OK)
		{
			index = nColumn;
			for (i = 0; i < nRow; i++)
			{
				for (j = 0; j < nColumn; j++)
				{
					//字段名:dbResult[j], 值:dbResult[index];
					strCount = UTF82WCS(dbResult[index]);
					index++;
				}
			}
			sqlite3_free_table(dbResult);	// 释放结果
		}
		if (errMsg!=NULL)
		{
			sqlite3_free(errMsg);
		}
		if(sql != NULL)
		{
			delete []sql;
			sql = NULL;
		}
	}
	sqlite3_close(m_hSql);

	return strCount;
}
//快速采集
// 接收功能模块传出的进度信息

afx_msg LRESULT CPage2::OnRetprogress(WPARAM wParam, LPARAM lParam)
{
	//AfxMessageBox(_T("收到消息"));
	int llType = *((int*)wParam);  //采集项
	PTASKPROGRESS prc = (PTASKPROGRESS)lParam;
	  if(llType == WEBENGINE_FAST)		// Web检测
	 {
		 if(m_pPageShare->m_pgsWebFile->GetPos() < prc->nProgress)
		 {
			 m_pPageShare->m_pgsWebFile->SetPos(prc->nProgress);
		 }
		 SetContentText(prc);
		 if(prc->nProgress == 1)
		 {
			 //if(m_TimerID != 0)
			 //	KillTimer(m_TimerID);
			 //TerminateThread(m_TimerThread, 0);
			 SetCurrentText(_T("Web检测"));
		 }
		 else if(prc->nProgress == 100)
		 {
			 m_bIsWEBFinish = TRUE;
			 m_pPageShare->m_pgsWebFile->ShowWindow(SW_HIDE);
			 //m_pPageShare->m_stcWebFileStat->SetWindowText(CWebModule::m_strWebFileStat);
			 m_pPageShare->m_stcWebFileStat->SetWindowText(_T("完成"));
			 m_pPageShare->m_stcWebFileStat->ShowWindow(SW_SHOW);
			 InvalidateRect(CRect(45,385,145,405));
			 InvalidateRect(m_pPageShare->m_rtWebFile);
			 CString str;
			 if(CTOOLBOX4App::m_bisUDisk)
			 {
				 str = CTOOLBOX4App::m_strSavePathKey;
				 str += _T("\\采集结果\\");
			 }else
			 {
				 str = CTOOLBOX4App::m_strSavePath;
				 str += _T("\\采集工具\\采集结果\\");
			 }
			 str += CDisposeResult::m_strMacAddr;
			 str += _T("\\应用层\\WebFile");
			 CString str1(_T("\n\t\t\t\t\t\t\t\t\t<td>"));
			 str1 += str;
			 str1 += _T("</td>");
			 CString str2(_T("\n\t\t\t\t\t\t\t\t\t<td>"));
			 str2 += CWebModule::m_strWebFileStat;
			 str2 += _T("</td>");
			 std::vector<CString> vt;
			 vt.push_back(str1);
			 vt.push_back(str2);
			 CDisposeResult::m_vWebFileRst.push_back(vt);
		 }
	}
	else if(llType == CHECK_SYSLOG)	// 系统日志
	{
	/*	if(prc->nProgress == 1)
		{
			SetCurrentText(_T("主机日志"));
			m_pPageShare->m_pgsHostLog->SetPos(10);

			m_pResult->util_sysLog = new CYunDunUtility;
			m_pResult->util_sysLog->SetXMLFile(_T("主机层\\SystemLogInfoResult.ydxml"));

			
		}
		else if(prc->nProgress == 50)
		{
			m_pPageShare->m_pgsHostLog->SetPos(20);
		}
		else if(prc->nProgress == 100)
		{
			m_pPageShare->m_pgsHostLog->SetPos(30);*/

		//	m_pResult->util_sysLog->WriteVector2XMLFile(m_pResult->m_svSysLog,"Sys_Log");
		//	m_pResult->FreeVectorMap(m_pResult->m_svSysLog);
		//	delete m_pResult->util_sysLog;
		/*	CString strCount = _T("0");
			sqlite3 * m_hSql;
			int ret;
			char ** dbResult = NULL;
			int nRow, nColumn;
			int i, j, index;
			char * errMsg = NULL;

			TCHAR dbPath[MAX_PATH] = {0};
			_tcsncpy(dbPath, CTOOLBOX4App::ms_strFullResultPath.GetBuffer(), MAX_PATH);
			_tcscat(dbPath, _T("主机层\\hongtan004.db"));
			char *cDbPath = UnicodeToUtf8(dbPath);
			ret = sqlite3_open(cDbPath, &m_hSql);
			if(ret != SQLITE_OK)
			{
				MessageBox(_T("打开数据库失败!"), _T("错误"), MB_ICONERROR);
				if(cDbPath != NULL)
				{
					delete []cDbPath;
					cDbPath = NULL;
				}
			}
			else
			{
				char *sql = "select count(*) from Sys_Log";
				ret = sqlite3_get_table(m_hSql, sql, &dbResult, &nRow, &nColumn, &errMsg);
				if(ret == SQLITE_OK)
				{
					index = nColumn;
					for (i = 0; i < nRow; i++)
					{
						for (j = 0; j < nColumn; j++)
						{
							//字段名:dbResult[j], 值:dbResult[index];
							strCount = UTF82WCS(dbResult[index]);
							LogCount=LogCount+atoi(dbResult[index]);
							index++;
						}
					}
					sqlite3_free_table(dbResult);	// 释放结果
				}
			}
			sqlite3_close(m_hSql);

			m_bIsFinish3 = TRUE;
			InvalidateRect(m_pPageShare->m_rtHostLog);
			m_pPageShare->m_pgsHostLog->SetPos(100);

			m_pPageShare->m_pgsHostLog->ShowWindow(SW_HIDE);
			CTOOLBOX4App::ms_csSysLog = strCount;
		}
		SetContentText(prc);
		*/
			if(prc->nProgress == 1)
			{
				SetCurrentText(_T("主机日志"));
				m_pPageShare->m_pgsHostLog->SetPos(10);

				m_pResult->util_sysLog = new CYunDunUtility;
				m_pResult->util_sysLog->SetXMLFile(_T("主机层\\SystemLogInfoResult.ydxml"));


			}
			else if(prc->nProgress == 50)
			{
				m_pPageShare->m_pgsHostLog->SetPos(20);
			}
			else if(prc->nProgress == 100)
			{
				m_pPageShare->m_pgsHostLog->SetPos(30);

				m_pResult->util_sysLog->WriteVector2XMLFile(m_pResult->m_svSysLog,"Sys_Log");
				m_pResult->FreeVectorMap(m_pResult->m_svSysLog);
				delete m_pResult->util_sysLog;
			}
			SetContentText(prc);

	}
	else if(llType == CHECK_APPLOG) // 应用程序日志
	{
		if(prc->nProgress == 1)
		{
			m_pPageShare->m_pgsHostLog->SetPos(40);
		}
		else if(prc->nProgress == 50)
		{
			m_pPageShare->m_pgsHostLog->SetPos(50);
		}
		else if(prc->nProgress == 100)
		{
			m_pPageShare->m_pgsHostLog->SetPos(60);
		}
		SetContentText(prc);
	}
	else if(llType == CHECK_SECLOG)	// 安全日志
	{
		SetContentText(prc);
		if(prc->nProgress == 1)
		{
			m_pPageShare->m_pgsHostLog->SetPos(70);
		}
		else if(prc->nProgress == 50)
		{

			m_pPageShare->m_pgsHostLog->SetPos(80);
		}
		else if(prc->nProgress == 100)
		{
			CString strsysCount = _T("0");
			CString strappCount = _T("0");

			CString strsecCount = _T("0");
			sqlite3 * m_hSql;
			int ret;
			char ** dbResult = NULL;
			int nRow, nColumn;
			int i, j, index;
			char * errMsg = NULL;
			DWORD LogCount=0;//日志总数
			TCHAR dbPath[MAX_PATH] = {0};
			_tcsncpy_s(dbPath, CTOOLBOX4App::ms_strFullResultPath.GetBuffer(), MAX_PATH);
			_tcscat_s(dbPath, _T("主机层\\hongtan004.db"));
			char *cDbPath = UnicodeToUtf8(dbPath);
			ret = sqlite3_open(cDbPath, &m_hSql);
			if(ret != SQLITE_OK)
			{
				MessageBox(_T("打开数据库失败!"), _T("错误"), MB_ICONERROR);
				if(cDbPath != NULL)
				{
					delete []cDbPath;
					cDbPath = NULL;
				}
			}
			else
			{
				const char *sql = "select count(*) from Win_Sec_Log";
				ret = sqlite3_get_table(m_hSql, sql, &dbResult, &nRow, &nColumn, &errMsg);
				if(ret == SQLITE_OK)
				{
					index = nColumn;
					for (i = 0; i < nRow; i++)
					{
						for (j = 0; j < nColumn; j++)
						{
							//字段名:dbResult[j], 值:dbResult[index];
							DWORD dCount=atoi(dbResult[index]);
							LogCount=LogCount+dCount;
							strsecCount = UTF82WCS(dbResult[index]);
							index++;
						}
					}
					sqlite3_free_table(dbResult);	// 释放结果
				}
				if (errMsg!=NULL)
				{
					sqlite3_free(errMsg);
				}
				const char *sql1 = "select count(*) from Application_Log";
				ret = sqlite3_get_table(m_hSql, sql1, &dbResult, &nRow, &nColumn, &errMsg);
				if(ret == SQLITE_OK)
				{
					index = nColumn;
					for (i = 0; i < nRow; i++)
					{
						for (j = 0; j < nColumn; j++)
						{
							//字段名:dbResult[j], 值:dbResult[index];
							DWORD dCount=atoi(dbResult[index]);
							LogCount=LogCount+dCount;
							strappCount = UTF82WCS(dbResult[index]);
							index++;
						}
					}
					sqlite3_free_table(dbResult);	// 释放结果
				}
				if (errMsg!=NULL)
				{
					sqlite3_free(errMsg);
				}
				const char *sql2 = "select count(*) from Sys_Log";
				ret = sqlite3_get_table(m_hSql, sql2, &dbResult, &nRow, &nColumn, &errMsg);
				if(ret == SQLITE_OK)
				{
					index = nColumn;
					for (i = 0; i < nRow; i++)
					{
						for (j = 0; j < nColumn; j++)
						{
							//字段名:dbResult[j], 值:dbResult[index];
							DWORD dCount=atoi(dbResult[index]);
							LogCount=LogCount+dCount;
							strsysCount = UTF82WCS(dbResult[index]);
							index++;
						}
					}
					sqlite3_free_table(dbResult);	// 释放结果
				}
			}
			if (errMsg!=NULL)
			{
				sqlite3_free(errMsg);
			}
			sqlite3_close(m_hSql);

			m_bIsHostLogFinish = TRUE;
			InvalidateRect(m_pPageShare->m_rtHostLog);
			m_pPageShare->m_pgsHostLog->SetPos(100);

			m_pPageShare->m_pgsHostLog->ShowWindow(SW_HIDE);
			CTOOLBOX4App::ms_csHostLog = strsecCount;
			CTOOLBOX4App::ms_csApplicationLog = strappCount;
			CTOOLBOX4App::ms_csSysLog = strsysCount;
			CString str;
			str.Format(_T("%d 条"), LogCount);
			m_pPageShare->m_stcHostLogStat->SetWindowText(str);
			m_pPageShare->m_stcHostLogStat->ShowWindow(SW_SHOW);
			InvalidateRect(CRect(320,385,420,405));
		}
	}
	else if(llType == CHECK_FILEINFO)	// 磁盘文件
	{
		SetCurrentText(_T("磁盘文件"));
		if(m_pPageShare->m_pgsFileInfoTrace->GetPos() < prc->nProgress)
		{
			m_pPageShare->m_pgsFileInfoTrace->SetPos(prc->nProgress);
		}
		if(prc->nProgress == 0)
			SetCurrentText(_T("磁盘文件"));
		else if(prc->nProgress == 100)
		{
			m_bIsFileInfoFinish = TRUE;
			m_pPageShare->m_pgsFileInfoTrace->ShowWindow(SW_HIDE);
			m_pPageShare->m_stcFileInfoTraceStat->SetWindowText(_T("完成"));
			m_pPageShare->m_stcFileInfoTraceStat->ShowWindow(SW_SHOW);
			InvalidateRect(m_pPageShare->m_rtFileInfoTrace);
		}
		SetContentText(prc);
	}
	else if(llType == CHECK_FILECHECK)  // 文件操作痕迹
	{
		if(m_pPageShare->m_pgsFileTrace->GetPos() < prc->nProgress)
		{
			m_pPageShare->m_pgsFileTrace->SetPos(prc->nProgress);
		}
		if(prc->nProgress == 0)
			SetCurrentText(_T("文件操作痕迹"));
		else if(prc->nProgress == 100)
		{
			CString count = GetTableCount(_T("File_Operation_Light"));

			m_bIsFileOperationFinish = TRUE;
			m_pPageShare->m_pgsFileTrace->ShowWindow(SW_HIDE);
			CTOOLBOX4App::ms_csFileTrace = count;
			CString str;
			str.Format(_T("%s 条"), count);
			m_pPageShare->m_stcFileTraceStat->SetWindowText(str);
			m_pPageShare->m_stcFileTraceStat->ShowWindow(SW_SHOW);
			//HANDLE hdFolctosqlite3 = (HANDLE)_beginthreadex(nullptr, 0, (unsigned (__stdcall*)(void*))&Folctosqlite3Thread, this, 0, nullptr);
			//WaitForSingleObject(hdFolctosqlite3,  INFINITE); // 永久等待
			//InvalidateRect(CRect(600,385,700,405));
			InvalidateRect(m_pPageShare->m_rtFileTrace);
		}
		SetContentText(prc);
	}
	else if(llType == CHECK_DATABASELOGINFO)  // 数据库日志
	{
		if(m_pPageShare->m_pgsDBLogTrace->GetPos() < prc->nProgress)
		{
			m_pPageShare->m_pgsDBLogTrace->SetPos(prc->nProgress);
		}
		if(prc->nProgress == 0)
			SetCurrentText(_T("数据库日志"));
		else if(prc->nProgress == 100)
		{
			/*CString count = GetTableCount(_T("File_Operation_Light"));*/

			m_bIsDBLogFinish = TRUE;
			m_pPageShare->m_pgsDBLogTrace->ShowWindow(SW_HIDE);
			//CTOOLBOX4App::ms_csFileTrace = count;
			CString str;
			str.Format(_T("完成"));
			m_pPageShare->m_stcDBLogTraceStat->SetWindowText(str);
			m_pPageShare->m_stcDBLogTraceStat->ShowWindow(SW_SHOW);
			//HANDLE hdFolctosqlite3 = (HANDLE)_beginthreadex(nullptr, 0, (unsigned (__stdcall*)(void*))&Folctosqlite3Thread, this, 0, nullptr);
			//WaitForSingleObject(hdFolctosqlite3,  INFINITE); // 永久等待
			//InvalidateRect(CRect(600,385,700,405));
			InvalidateRect(m_pPageShare->m_rtDbLog);
		}
		SetContentText(prc);
	}
	else if(llType == CHECK_HOSTBASEINFO)  // 操作系统
	{
		if(m_pPageShare->m_pgsHostBaseInfoTrace->GetPos() < prc->nProgress)
		{
			m_pPageShare->m_pgsHostBaseInfoTrace->SetPos(prc->nProgress);
		}
		if(prc->nProgress == 0)
			SetCurrentText(_T("操作系统"));
		else if(prc->nProgress == 100)
		{
			//CString count = GetTableCount(_T("File_Operation_Light"));

			m_bIsHostBaseInfoFinish = TRUE;
			m_pPageShare->m_pgsHostBaseInfoTrace->ShowWindow(SW_HIDE);
		//	CTOOLBOX4App::ms_csFileTrace = count;
			CString str;
			str.Format(_T("完成"));
			m_pPageShare->m_stcHostBaseInfoTraceStat->SetWindowText(str);
			m_pPageShare->m_stcHostBaseInfoTraceStat->ShowWindow(SW_SHOW);
			//HANDLE hdFolctosqlite3 = (HANDLE)_beginthreadex(nullptr, 0, (unsigned (__stdcall*)(void*))&Folctosqlite3Thread, this, 0, nullptr);
			//WaitForSingleObject(hdFolctosqlite3,  INFINITE); // 永久等待
			//InvalidateRect(CRect(600,385,700,405));
			InvalidateRect(m_pPageShare->m_rtHostBaseInfoTrace);
		}
		SetContentText(prc);
	}
	else if(llType == CHECK_STARTUPINFO)  // 启动项
	{
		if(m_pPageShare->m_pgsStartUpInfoTrace->GetPos() < prc->nProgress)
		{
			m_pPageShare->m_pgsStartUpInfoTrace->SetPos(prc->nProgress);
		}
		if(prc->nProgress == 0)
			SetCurrentText(_T("启动项信息"));
		else if(prc->nProgress == 100)
		{
			CString count = GetTableCount(_T("startup_info"));

			m_bIsStartUpInfoFinish = TRUE;
			m_pPageShare->m_pgsStartUpInfoTrace->ShowWindow(SW_HIDE);
			//	CTOOLBOX4App::ms_csFileTrace = count;
			CString str;
			str.Format(_T("%s 条"), count);
			m_pPageShare->m_stcStartUpInfoTraceStat->SetWindowText(str);
			m_pPageShare->m_stcStartUpInfoTraceStat->ShowWindow(SW_SHOW);
			//HANDLE hdFolctosqlite3 = (HANDLE)_beginthreadex(nullptr, 0, (unsigned (__stdcall*)(void*))&Folctosqlite3Thread, this, 0, nullptr);
			//WaitForSingleObject(hdFolctosqlite3,  INFINITE); // 永久等待
			//InvalidateRect(CRect(600,385,700,405));
			InvalidateRect(m_pPageShare->m_rtStartUpInfoTrace);
		}
		SetContentText(prc);
	}
	else if(llType == CHECK_TASKLISTSINFO)  // 计划任务
	{
		if(m_pPageShare->m_pgsTaskInfoTrace->GetPos() < prc->nProgress)
		{
			m_pPageShare->m_pgsTaskInfoTrace->SetPos(prc->nProgress);
		}
		if(prc->nProgress == 0)
			SetCurrentText(_T("计划任务信息"));
		else if(prc->nProgress == 100)
		{
			CString count = GetTableCount(_T("plan_tasks"));

			m_bIsTaskInfoFinish = TRUE;
			m_pPageShare->m_pgsTaskInfoTrace->ShowWindow(SW_HIDE);
			//	CTOOLBOX4App::ms_csFileTrace = count;
			CString str;
			str.Format(_T("%s 条"), count);
			m_pPageShare->m_stcTaskInfoTraceStat->SetWindowText(str);
			m_pPageShare->m_stcTaskInfoTraceStat->ShowWindow(SW_SHOW);
			//HANDLE hdFolctosqlite3 = (HANDLE)_beginthreadex(nullptr, 0, (unsigned (__stdcall*)(void*))&Folctosqlite3Thread, this, 0, nullptr);
			//WaitForSingleObject(hdFolctosqlite3,  INFINITE); // 永久等待
			//InvalidateRect(CRect(600,385,700,405));
			InvalidateRect(m_pPageShare->m_rtTaskInfoTrace);
		}
		SetContentText(prc);
	}
	else if(llType == CHECK_LOGPOLICY)  // 日志策略
	{
		if(m_pPageShare->m_pgsLogPolicyTrace->GetPos() < prc->nProgress)
		{
			m_pPageShare->m_pgsLogPolicyTrace->SetPos(prc->nProgress);
		}
		if(prc->nProgress == 0)
			SetCurrentText(_T("日志策略"));
		else if(prc->nProgress == 100)
		{
			//CString count = GetTableCount(_T("File_Operation_Light"));

			m_bIsLogPolicyFinish = TRUE;
			m_pPageShare->m_pgsLogPolicyTrace->ShowWindow(SW_HIDE);
		//	CTOOLBOX4App::ms_csFileTrace = count;
			CString str;
			str.Format(_T("完成策略检测"));
			m_pPageShare->m_stcLogPolicyTraceStat->SetWindowText(str);
			m_pPageShare->m_stcLogPolicyTraceStat->ShowWindow(SW_SHOW);
			//HANDLE hdFolctosqlite3 = (HANDLE)_beginthreadex(nullptr, 0, (unsigned (__stdcall*)(void*))&Folctosqlite3Thread, this, 0, nullptr);
			//WaitForSingleObject(hdFolctosqlite3,  INFINITE); // 永久等待
			//InvalidateRect(CRect(600,385,700,405));
			InvalidateRect(m_pPageShare->m_rtLogPolicyTrace);
		}
		SetContentText(prc);
	}
	else if(llType == CHECK_PATHINFO)  //系统补丁
	{
		if(m_pPageShare->m_pgsPathInfoTrace->GetPos() < prc->nProgress)
		{
			m_pPageShare->m_pgsPathInfoTrace->SetPos(prc->nProgress);
		}
		if(prc->nProgress == 0)
			SetCurrentText(_T("系统补丁"));
		else if(prc->nProgress == 100)
		{
			//CString count = GetTableCount(_T("File_Operation_Light"));

			m_bIsPathInfoFinish = TRUE;
			m_pPageShare->m_pgsPathInfoTrace->ShowWindow(SW_HIDE);
			CString count = GetTableCount(_T("path_info"));

			m_bIsFileOperationFinish = TRUE;
			m_pPageShare->m_pgsPathInfoTrace->ShowWindow(SW_HIDE);
			CTOOLBOX4App::ms_csFileTrace = count;
			CString str;
			str.Format(_T("%s 条"), count);
			m_pPageShare->m_stcPathInfoTraceStat->SetWindowText(str);
			m_pPageShare->m_stcPathInfoTraceStat->ShowWindow(SW_SHOW);
			//HANDLE hdFolctosqlite3 = (HANDLE)_beginthreadex(nullptr, 0, (unsigned (__stdcall*)(void*))&Folctosqlite3Thread, this, 0, nullptr);
			//WaitForSingleObject(hdFolctosqlite3,  INFINITE); // 永久等待
			//InvalidateRect(CRect(600,385,700,405));
			InvalidateRect(m_pPageShare->m_rtPathInfoTrace);
		}
		SetContentText(prc);
	}
	else if(llType == CHECK_ARP)  // arp
	{
		if(m_pPageShare->m_pgsARPTrace->GetPos() < prc->nProgress)
		{
			m_pPageShare->m_pgsARPTrace->SetPos(prc->nProgress);
		}
		if(prc->nProgress == 0)
			SetCurrentText(_T("ARP记录"));
		else if(prc->nProgress == 100)
		{
			CString count = GetTableCount(_T("arp"));

			m_bIsARPFinish = TRUE;
			m_pPageShare->m_pgsARPTrace->ShowWindow(SW_HIDE);
		//	CTOOLBOX4App::ms_csFileTrace = count;
			CString str;
			str.Format(_T("%s 条"), count);
			m_pPageShare->m_stcARPTraceStat->SetWindowText(str);
			m_pPageShare->m_stcARPTraceStat->ShowWindow(SW_SHOW);
			//HANDLE hdFolctosqlite3 = (HANDLE)_beginthreadex(nullptr, 0, (unsigned (__stdcall*)(void*))&Folctosqlite3Thread, this, 0, nullptr);
			//WaitForSingleObject(hdFolctosqlite3,  INFINITE); // 永久等待
			//InvalidateRect(CRect(740,385,840,405));
			InvalidateRect(m_pPageShare->m_rtARPTrace);
		}
		SetContentText(prc);
	}
	else if(llType == CHECK_DNS)  // DNS
	{
		if(m_pPageShare->m_pgsDNSTrace->GetPos() < prc->nProgress)
		{
			m_pPageShare->m_pgsDNSTrace->SetPos(prc->nProgress);
		}
		if(prc->nProgress == 0)
			SetCurrentText(_T("DNS记录"));
		else if(prc->nProgress == 100)
		{
			CString count = GetTableCount(_T("dns"));

			m_bIsDNSFinish = TRUE;
			m_pPageShare->m_pgsDNSTrace->ShowWindow(SW_HIDE);
			//	CTOOLBOX4App::ms_csFileTrace = count;
			CString str;
			str.Format(_T("%s 条"), count);
			m_pPageShare->m_stcDNSTraceStat->SetWindowText(str);
			m_pPageShare->m_stcDNSTraceStat->ShowWindow(SW_SHOW);
			//HANDLE hdFolctosqlite3 = (HANDLE)_beginthreadex(nullptr, 0, (unsigned (__stdcall*)(void*))&Folctosqlite3Thread, this, 0, nullptr);
			//WaitForSingleObject(hdFolctosqlite3,  INFINITE); // 永久等待
			//InvalidateRect(CRect(740,385,840,405));
			InvalidateRect(m_pPageShare->m_rtDNSTrace);
		}
		SetContentText(prc);
	}
	else if(llType == CHECK_USN)  // USN
	{
		if(m_pPageShare->m_pgsUSNTrace->GetPos() < prc->nProgress)
		{
			m_pPageShare->m_pgsUSNTrace->SetPos(prc->nProgress);
		}
		if(prc->nProgress == 0)
			SetCurrentText(_T("USN记录"));
		else if(prc->nProgress == 100)
		{
			m_bIsUSNFinish = TRUE;
			m_pPageShare->m_pgsUSNTrace->ShowWindow(SW_HIDE);
			m_pPageShare->m_stcUSNTraceStat->SetWindowText(_T("完成"));
			m_pPageShare->m_stcUSNTraceStat->ShowWindow(SW_SHOW);
			InvalidateRect(m_pPageShare->m_rtUSNTrace);
		}
		SetContentText(prc);
	}
	else if (llType == CHECK_INTERCHECK) // 联网痕迹 轻度
	{
		if(m_pPageShare->m_pgsNetTrace->GetPos() < prc->nProgress)
		{
			m_pPageShare->m_pgsNetTrace->SetPos(prc->nProgress);
		}
		if(prc->nProgress == 0)
			SetCurrentText(_T("联网痕迹"));
		else if(prc->nProgress == 100)
		{
			CString count = GetTableCount(_T("Net_Light_Check"));
			m_bIsInterFinish = TRUE;
			m_pPageShare->m_pgsNetTrace->ShowWindow(SW_HIDE);
			CTOOLBOX4App::ms_csNetTrace = count;
			CString str;
			str.Format(_T("%s 条"), count);
			CReport::m_ulNetTrace = _ttol(count);
			m_pPageShare->m_stcNetTraceStat->SetWindowText(str);
			m_pPageShare->m_stcNetTraceStat->ShowWindow(SW_SHOW);
			InvalidateRect(CRect(740,385,840,405));
			InvalidateRect(m_pPageShare->m_rtNetTrace);
		}
		SetContentText(prc);
	}
	else if(llType == CHECK_PORTCHECK)      // 网络连接
	{
		if(m_pPageShare->m_pgsPort->GetPos() < prc->nProgress)
		{
			m_pPageShare->m_pgsPort->SetPos(prc->nProgress);
		}
		if(prc->nProgress == 0)
			SetCurrentText(_T("网络连接"));
		else if(prc->nProgress == 100)
		{
			CString count = GetTableCount(_T("Sys_Port_Info"));
			m_bIsPortFinish = TRUE;
			m_pPageShare->m_pgsPort->ShowWindow(SW_HIDE);
			CTOOLBOX4App::ms_csPort= count;
			CString str;
			str.Format(_T("%s 个"), count);
			CReport::m_ulPort = _ttol(count);
			m_pPageShare->m_stcPortStat->SetWindowText(str);
			m_pPageShare->m_stcPortStat->ShowWindow(SW_SHOW);
			InvalidateRect(CRect(880,385,980,405));
			InvalidateRect(m_pPageShare->m_rtPort);
		}
		SetContentText(prc);
	}
	else if(llType == CHECK_PROCESSCHECK)		 // 进程
	{
		if(m_pPageShare->m_pgsProcess->GetPos() < prc->nProgress)
		{
			m_pPageShare->m_pgsProcess->SetPos(prc->nProgress);
		}
		if(prc->nProgress == 0)
			SetCurrentText(_T("进程"));
		else if(prc->nProgress == 100)
		{
			CString count = GetTableCount(_T("Process"));
			m_bIsProcessFinish = TRUE;
			m_pPageShare->m_pgsProcess->ShowWindow(SW_HIDE);
			CTOOLBOX4App::ms_csProcess = count;
			CString str;
			str.Format(_T("%s 个"), count);
			CReport::m_ulProcess = _ttol(count);
			m_pPageShare->m_stcProcessStat->SetWindowText(str);
			m_pPageShare->m_stcProcessStat->ShowWindow(SW_SHOW);
			InvalidateRect(CRect(45,550,145,570));
			InvalidateRect(m_pPageShare->m_rtProcess);
		}
		SetContentText(prc);
	}
	else if(llType == CHECK_SERVERCHECK)      // 服务
	{
		if(m_pPageShare->m_pgsService->GetPos() < prc->nProgress)
		{
			m_pPageShare->m_pgsService->SetPos(prc->nProgress);
		}
		if(prc->nProgress == 0)
			SetCurrentText(_T("服务"));
		else if(prc->nProgress == 100)
		{
			CString count = GetTableCount(_T("Service"));
			m_bIsServiceFinish = TRUE;
			m_pPageShare->m_pgsService->ShowWindow(SW_HIDE);
			CTOOLBOX4App::ms_csService = count;
			CString str;
			str.Format(_T("%s 个"), count);
			CReport::m_ulService = _ttol(count);
			m_pPageShare->m_stcServiceStat->SetWindowText(str);
			m_pPageShare->m_stcServiceStat->ShowWindow(SW_SHOW);
			InvalidateRect(CRect(180,550,280,570));
			InvalidateRect(m_pPageShare->m_rtService);
		}
		SetContentText(prc);
	}
	else if(llType == CHECK_SOFTCHECK)  // 安装软件
	{
		if(m_pPageShare->m_pgsSoftWare->GetPos() < prc->nProgress)
		{
			m_pPageShare->m_pgsSoftWare->SetPos(prc->nProgress);
		}
		if(prc->nProgress == 1)
			SetCurrentText(_T("安装软件"));
		else if(prc->nProgress == 100)
		{
			CString count = GetTableCount(_T("Key_Software"));
			m_bIsSoftWareFinish = TRUE;
			m_pPageShare->m_pgsSoftWare->ShowWindow(SW_HIDE);
			CTOOLBOX4App::ms_csSoftware = count;
			CString str;
			str.Format(_T("%s个"), count);
			CReport::m_ulSoftWare = _ttol(count);
			m_pPageShare->m_stcSoftWareStat->SetWindowText(str);
			m_pPageShare->m_stcSoftWareStat->ShowWindow(SW_SHOW);
			InvalidateRect(CRect(320,550,420,570));
			InvalidateRect(m_pPageShare->m_rtSoftWare);

			////////安装软件, 即时通讯软件, 邮件客户端 入库////////////
			//m_hSoftWare_Fast = (HANDLE)_beginthreadex(nullptr, 0, (unsigned (__stdcall*)(void*))&SoftWare_fast, this, 0, nullptr);
			//WaitForSingleObject(m_hSoftWare_Fast,  INFINITE); // 永久等待
			//m_pResult->SoftWareInsertDb();
		/*	// 安装软件 入库了,不需要写xml文件
			CYunDunUtility util;
			//设置输出的XML文件名
			util.SetXMLFile(XMLFileName);
			util.WriteVector2XMLFile(nBRes,"SoftWare_Info");
			nBRes.clear();
		*/
		}
		SetContentText(prc);
	}
	else if(llType == CHECK_SECBASELINECHECK1)	// 授权安全
	{
		//CString str;
		//str.Format(_T("授权安全 %s "), prc->pszText);
		//AfxMessageBox(str);
		if(prc->nProgress == 0)
		{
			SetCurrentText(_T("安全基线"));
			m_pPageShare->m_pgsAccountSec->SetPos(8);
		}
		else if(prc->nProgress == 100)
			m_pPageShare->m_pgsAccountSec->SetPos(16);
		SetContentText(prc);
	}
	else if(llType == CHECK_SECBASELINECHECK2)  // 账户安全
	{
		if(prc->nProgress == 0)
			m_pPageShare->m_pgsAccountSec->SetPos(24);
		else if(prc->nProgress == 100)
			m_pPageShare->m_pgsAccountSec->SetPos(32);
		//CString str;
		//str.Format(_T("账户安全 %s "), prc->pszText);
		//AfxMessageBox(str);
		SetContentText(prc);
	}
	else if(llType == CHECK_SECBASELINECHECK3)	// 服务访问安全
	{
		if(prc->nProgress == 0)
			m_pPageShare->m_pgsAccountSec->SetPos(40);
		else if(prc->nProgress == 100)
			m_pPageShare->m_pgsAccountSec->SetPos(48);
		SetContentText(prc);
		//CString str;
		//str.Format(_T("服务访问安全 %s "), prc->pszText);
		//AfxMessageBox(str);
	}
	else if(llType == CHECK_SECBASELINECHECK4)	// 口令安全
	{
		if(prc->nProgress == 0)
			m_pPageShare->m_pgsAccountSec->SetPos(56);
		else if(prc->nProgress == 100)
			m_pPageShare->m_pgsAccountSec->SetPos(64);
		SetContentText(prc);
		//CString str;
		//str.Format(_T("口令安全 %s "), prc->pszText);
		//AfxMessageBox(str);
	}
	else if(llType == CHECK_SECBASELINECHECK5)	// 网络访问安全
	{
		if(prc->nProgress == 0)
			m_pPageShare->m_pgsAccountSec->SetPos(72);
		else if(prc->nProgress == 100)
			m_pPageShare->m_pgsAccountSec->SetPos(80);
		SetContentText(prc);
		//CString str;
		//str.Format(_T("网络访问安全 %s "), prc->pszText);
		//AfxMessageBox(str);
	}
	else if(llType == CHECK_SECBASELINECHECK6)	// 文件访问安全
	{
		if(prc->nProgress == 0)
			m_pPageShare->m_pgsAccountSec->SetPos(90);
		else if(prc->nProgress == 100)
		{
			CString count = GetTableCount(_T("Sec_Base_Line"));
			m_pPageShare->m_pgsAccountSec->SetPos(100);
			m_bIsAccountSecFinish = TRUE;
			m_pPageShare->m_pgsAccountSec->ShowWindow(SW_HIDE);

			//////////////安全基线结果入库sqlite3 /////////////////////
			//m_hSecBaseLine_Fase = (HANDLE)_beginthreadex(nullptr, 0, (unsigned (__stdcall*)(void*))&SecBaseLine_fast, this, 0, nullptr);
			//WaitForSingleObject(m_hSecBaseLine_Fase,  INFINITE); // 永久等待
			//////////////安全基线结果入库sqlite3 /////////////////////
			CString str;
			str.Format(_T("%s条"), count);
			CReport::m_ulSecBaseLine = _ttol(count);
			m_pPageShare->m_stcAccountSecStat->SetWindowText(str);
			m_pPageShare->m_stcAccountSecStat->ShowWindow(SW_SHOW);
			InvalidateRect(CRect(460,550,560,570));
			InvalidateRect(m_pPageShare->m_rtAccountSec);
		}
		SetContentText(prc);
		//CString str;
		//str.Format(_T("文件访问安全 %s "), prc->pszText);
		//AfxMessageBox(str);
	}
	else if(llType == CHECK_FILESHARE)  // 文件共享
	{
		if(m_pPageShare->m_pgsFileShare->GetPos() < prc->nProgress)
		{
			m_pPageShare->m_pgsFileShare->SetPos(prc->nProgress);
		}
		if(prc->nProgress == 0)
			SetCurrentText(_T("文件共享"));
		else if(prc->nProgress == 100)
		{
			CString count = GetTableCount(_T("File_Share_Info"));
			m_bIsFileShareFinish = TRUE;
			m_pPageShare->m_pgsFileShare->ShowWindow(SW_HIDE);
			CTOOLBOX4App::ms_csFileShare = count;
			CString str;
			str.Format(_T("%s 个"), count);
			m_pPageShare->m_stcFileShareStat->SetWindowText(str);
			m_pPageShare->m_stcFileShareStat->ShowWindow(SW_SHOW);
			InvalidateRect(CRect(600,550,700,570));
			InvalidateRect(m_pPageShare->m_rtFileShare);

		}
		SetContentText(prc);
	}
	else if(llType == CHECK_USBCHECK)    // USB插拔记录
	{
		if(m_pPageShare->m_pgsUSBTrace->GetPos() < prc->nProgress)
		{
			m_pPageShare->m_pgsUSBTrace->SetPos(prc->nProgress);
		}
		if(prc->nProgress == 0)
			SetCurrentText(_T("USB插拔记录"));
		else if(prc->nProgress == 100)
		{
			CString count = GetTableCount(_T("Usb_Light"));
			m_bIsUSBFinish = TRUE;
			m_pPageShare->m_pgsUSBTrace->ShowWindow(SW_HIDE);
			CTOOLBOX4App::ms_csUSBTrace = count;
			CString str;
			str.Format(_T("%s 条"), count);
			CReport::m_ulUsbTrace = _ttol(count);
			m_pPageShare->m_stcUSBTraceStat->SetWindowText(str);
			m_pPageShare->m_stcUSBTraceStat->ShowWindow(SW_SHOW);
			InvalidateRect(CRect(740,550,840,570));
			InvalidateRect(m_pPageShare->m_rtUSBTrace);
		}
		SetContentText(prc);	
	}
	else if(llType == CHECK_ANALYZE)  // 综合分析
	{
		if(m_pPageShare->m_pgsAnalyze->GetPos() < prc->nProgress)
		{
			m_pPageShare->m_pgsAnalyze->SetPos(prc->nProgress);
		}
		if(prc->nProgress == 1)
		{
			SetCurrentText(_T("综合分析"));
			m_hTimer30Thread = (HANDLE)_beginthreadex(nullptr, 0, (unsigned (__stdcall*)(void*))&myTimer30Thread, this, 0, nullptr);
		}
		else if(prc->nProgress == 100)
		{
			if(m_Timer30ID != 0)
				KillTimer(m_Timer30ID);
			TerminateThread(m_hTimer30Thread, 0);

			m_bIsAnalyzeFinish = TRUE;
			m_pPageShare->m_pgsAnalyze->ShowWindow(SW_HIDE);
			m_pPageShare->m_stcAnalyzeStat->SetWindowText(_T("完成"));
			m_pPageShare->m_stcAnalyzeStat->ShowWindow(SW_SHOW);
			InvalidateRect(CRect(870,550,970,570));
			InvalidateRect(m_pPageShare->m_rtDbLog);
		}
		SetContentText(prc);
	}
	else if (llType == CHECK_NETWORKCARD)  // 网卡
	{
		if (m_pPageShare->m_pgsNetWorkCard->GetPos() < prc->nProgress)
		{
			m_pPageShare->m_pgsNetWorkCard->SetPos(prc->nProgress);
		}
		if (prc->nProgress == 1)
		{
			SetCurrentText(_T("网卡"));
		}
		else if (prc->nProgress == 100)
		{
			m_bIsNetWorkFinish = TRUE;
			m_pPageShare->m_pgsNetWorkCard->ShowWindow(SW_HIDE);
			m_pPageShare->m_stcNetWorkCardStat->SetWindowText(_T("完成"));
			m_pPageShare->m_stcNetWorkCardStat->ShowWindow(SW_SHOW);
			InvalidateRect(m_pPageShare->m_rtNetWorkCard);
		}
		SetContentText(prc);
	}
	else if (llType == CHECK_MEMORY)  // 内存镜像
	{
		if (m_pPageShare->m_pgsMemory->GetPos() < prc->nProgress)
		{
			m_pPageShare->m_pgsMemory->SetPos(prc->nProgress);
		}
		if (prc->nProgress == 1)
		{
			SetCurrentText(_T("内存"));
		}
		else if (prc->nProgress == 100)
		{
			m_bIsMemoryFinish = TRUE;
			m_pPageShare->m_pgsMemory->ShowWindow(SW_HIDE);
			m_pPageShare->m_stcMemoryStat->SetWindowText(_T("完成"));
			m_pPageShare->m_stcMemoryStat->ShowWindow(SW_SHOW);
			InvalidateRect(m_pPageShare->m_rtMemory);
		}
		SetContentText(prc);
	}
	else if (llType == CHECK_HARDWARE)  // 硬件信息
	{
		if (m_pPageShare->m_pgsHardware->GetPos() < prc->nProgress)
		{
			m_pPageShare->m_pgsHardware->SetPos(prc->nProgress);
		}
		if (prc->nProgress == 1)
		{
			SetCurrentText(_T("硬件"));
		}
		else if (prc->nProgress == 100)
		{
			m_bIsHardwareFinish = TRUE;
			m_pPageShare->m_pgsHardware->ShowWindow(SW_HIDE);
			m_pPageShare->m_stcHardwareStat->SetWindowText(_T("完成"));
			m_pPageShare->m_stcHardwareStat->ShowWindow(SW_SHOW);
			InvalidateRect(m_pPageShare->m_rtHardware);
		}
		SetContentText(prc);
		}
	else if (llType == CHECK_WIRELESS)  // 无线通讯设备
	{
		if (m_pPageShare->m_pgsWireless->GetPos() < prc->nProgress)
		{
			m_pPageShare->m_pgsWireless->SetPos(prc->nProgress);
		}
		if (prc->nProgress == 1)
		{
			SetCurrentText(_T("硬件"));
		}
		else if (prc->nProgress == 100)
		{
			m_bIsWirelessFinish = TRUE;
			m_pPageShare->m_pgsWireless->ShowWindow(SW_HIDE);
			m_pPageShare->m_stcWirelessStat->SetWindowText(_T("完成"));
			m_pPageShare->m_stcWirelessStat->ShowWindow(SW_SHOW);
			InvalidateRect(m_pPageShare->m_rtWireless);
		}
		SetContentText(prc);
		}
	else if (llType == CHECK_CLIPBOARD)  // 剪切板内容
	{
		if (m_pPageShare->m_pgsClipboard->GetPos() < prc->nProgress)
		{
			m_pPageShare->m_pgsClipboard->SetPos(prc->nProgress);
		}
		if (prc->nProgress == 1)
		{
			SetCurrentText(_T("剪切板内容"));
		}
		else if (prc->nProgress == 100)
		{
			m_bIsClipboardFinish = TRUE;
			m_pPageShare->m_pgsClipboard->ShowWindow(SW_HIDE);
			m_pPageShare->m_stcClipboardStat->SetWindowText(_T("完成"));
			m_pPageShare->m_stcClipboardStat->ShowWindow(SW_SHOW);
			InvalidateRect(m_pPageShare->m_rtClipboard);
		}
		SetContentText(prc);
		}
	return 0;
}

// 接收功能模块传出的结果
afx_msg LRESULT CPage2::OnRetresult(WPARAM wParam, LPARAM lParam)
{
	int llType = *((int*)wParam);
	if(llType == WEBENGINE_FAST)	// Web文件
	{
		//AfxMessageBox(_T("收到消息"));
		pWEBFILE webfile = (pWEBFILE)lParam;
		CString str(webfile->WebFileName);
		str.Replace(_T("\\\\?\\"), _T(""));
		m_pPageShare->m_stcContent->ShowWindow(SW_SHOW);
		m_pPageShare->m_stcContent->SetWindowText(str);
		CRect rt;
		m_pPageShare->m_stcContent->GetWindowRect(rt);
		ScreenToClient(rt);
		InvalidateRect(&rt);
		//AfxMessageBox(str);
	}
	else if(llType == CHECK_SYSLOG)		// 系统日志
	{
		//AfxMessageBox(_T("系统日志"));
		//CDisposeResult rst;
		//m_pResult->GetResult(CHECK_SYSLOG, lParam);
		//PSYSTEMLOGINFO pPc = (PSYSTEMLOGINFO)lParam;
		//++m_ulHostLogNum;
		
		//CString str;
		//str.Format(_T("%s,%s"),pPc->event_id,pPc->task_type);
		//AfxMessageBox(str);
	}
	else if(llType == CHECK_APPLOG)	// 应用程序日志
	{
		//AfxMessageBox(_T("app日志"));
		//CDisposeResult rst;
		//m_pResult->GetResult(CHECK_APPLOG, lParam);
		//PSYSTEMLOGINFO pPc = (PSYSTEMLOGINFO)lParam;
		//++m_ulHostLogNum;
		//pPc->
		//CString str;
		//str.Format(_T("%s,%s"),pPc->event_level,pPc->source);
		//AfxMessageBox(str);
	}
	else if(llType == CHECK_SECLOG) // 安全日志
	{
		//AfxMessageBox(_T("安全日志"));
		//CDisposeResult rst;
		m_pResult->GetResult(CHECK_SECLOG, lParam);
		//PSECURITYLOGINFO pPc = (PSECURITYLOGINFO)lParam;
		++m_ulHostLogNum;
		
		//CString str;
		//str.Format(_T("%s,%s"),pPc->event_level,pPc->event_id);
		//AfxMessageBox(str);
	}
/*	else if(llType == CHECK_PATCHCHECK)	// 系统补丁
	{
		//CDisposeResult rst;
		m_pResult->GetResult(CHECK_PATCHCHECK, lParam);
		++m_ulSysPacthNum;
		PSYSPATCHINFO pPc = (PSYSPATCHINFO)lParam;
		//pPc->
		map<string, CString> map1;
		CString str;
		str.Format(_T("%d"), pPc->nIfInstalled);
		map1.insert(pair<string,CString>("PatchLevel",pPc->strPatchLevel));
		map1.insert(pair<string,CString>("PatchID",pPc->strPatchID));
		map1.insert(pair<string,CString>("PatchDesc",pPc->strPatchDesc));
		map1.insert(pair<string,CString>("PatchDate",pPc->strPatchDate));
		map1.insert(pair<string,CString>("PatchURL",pPc->strPatchURL));
		map1.insert(pair<string,CString>("IfInstalled",str));
		map1.insert(pair<string,CString>("LastTime",pPc->strLastTime));

		nBRes.push_back(map1);
		//CString str;
		//str.Format(_T("%s,%s,%s,%s,%s,%s,%d"),pPc->strLastTime,pPc->strPatchDesc,pPc->strPatchDate,pPc->strPatchID,pPc->strPatchLevel,pPc->strPatchURL,pPc->nIfInstalled);
		//AfxMessageBox(str);
	}*/
	else if(llType == CHECK_FILECHECK)// 文件操作痕迹
	{
		//CDisposeResult rst;
		//m_pResult->GetResult(CHECK_FILECHECK, lParam);
		m_pResult->GetResult(CHECK_FILECHECK, lParam);
		++m_ulFileTraceNum;
		//CString str;
		//str.Format(_T("%s,%s"),pPc->fileName,pPc->filePath);
		//AfxMessageBox(str);
	}
	else if(llType == CHECK_PATHINFO)// 系统补丁
	{
		//CDisposeResult rst;
		//m_pResult->GetResult(CHECK_FILECHECK, lParam);
		m_pResult->GetResult(CHECK_PATHINFO, lParam);
		++m_ulPathInfoNum;
		//CString str;
		//str.Format(_T("%s,%s"),pPc->fileName,pPc->filePath);
		//AfxMessageBox(str);
	}
	else if(llType == CHECK_ARP)// arp
	{
		//CDisposeResult rst;
		//m_pResult->GetResult(CHECK_FILECHECK, lParam);
		m_pResult->GetResult(CHECK_ARP, lParam);
		++m_ulARPNum;
		//CString str;
		//str.Format(_T("%s,%s"),pPc->fileName,pPc->filePath);
		//AfxMessageBox(str);
	}
	else if(llType == CHECK_USN)// usn
	{
		//CDisposeResult rst;
		//m_pResult->GetResult(CHECK_FILECHECK, lParam);
		m_pResult->GetResult(CHECK_USN, lParam);
		++m_ulUSNNum;
		//CString str;
		//str.Format(_T("%s,%s"),pPc->fileName,pPc->filePath);
		//AfxMessageBox(str);
	}
	else if(llType == CHECK_INTERCHECK)   // 联网痕迹
	{
		//CDisposeResult rst;
		//m_pResult->GetResult(CHECK_INTERCHECK, lParam);
		++m_ulNetTraceNum;
		//AfxMessageBox(_T("收到"));
		PINTERNETRECORD pPc = (PINTERNETRECORD)lParam;
		//CString str;
		//str.Format(_T("%s,%s,%s,%s,%s"),pPc->Date,pPc->Name,pPc->Process,pPc->Spread,pPc->Versions);
		//AfxMessageBox(str);
		
		//CString str;
		//str.Format(_T("%s,%s"),pPc->Date,pPc->Name);
		//AfxMessageBox(str);
	}
	else if(llType == CHECK_PORTCHECK)  // 端口
	{
		//CDisposeResult rst;
		m_pResult->GetResult(CHECK_PORTCHECK, lParam);
		++m_ulPortNum;
		PPORTINFO pPc = (PPORTINFO)lParam;
		
	}
	else if(llType == CHECK_PROCESSCHECK) // 进程
	{
		//CDisposeResult rst;
		m_pResult->GetResult(CHECK_PROCESSCHECK, lParam);
		++m_ulProcessNum;
		PPROCESSINFO_ASSET pPc = (PPROCESSINFO_ASSET)lParam;
		//CString str;
		//str.Format(_T("[%s]-[%s]-[%s]-[%s]"), pPc->strPath,pPc->strPID,pPc->strPName,pPc->strSign);
		//AfxMessageBox(str);
	}
	else if(llType == CHECK_SERVERCHECK)  // 服务
	{
		PSERVICEINFO_ASSET pPc = (PSERVICEINFO_ASSET)lParam;
		//PSERVICEINFO_ASSET pPc = (PSERVICEINFO_ASSET)lParam;
		//CString str;
		//str.Format(_T("%s"), pPc->IsAutoStart);

		//CDisposeResult rst;
		m_pResult->GetResult(CHECK_SERVERCHECK, lParam);
		++m_ulServiceNum;

		//PSERVICEINFO pPc = (PSERVICEINFO)lParam;
		//CString str;
		//str.Format(_T("%s"), pPc->s_autorun);
	}
	else if(llType == CHECK_SOFTCHECK)  // 安装软件
	{
		//CDisposeResult rst;
		m_pResult->GetResult(CHECK_SOFTCHECK, lParam);
		++m_ulSoftWareNum;
		PSOFTWAREINFO pPc = (PSOFTWAREINFO)lParam;
		//pPc->
		//map<string, CString> map1;
		//map1.insert(pair<string,CString>("Name",pPc->strName));
		//map1.insert(pair<string,CString>("Version",pPc->strVersion));
		//map1.insert(pair<string,CString>("Publisher",pPc->strPublisher));
		//map1.insert(pair<string,CString>("InstallDate",pPc->strInstallDate));
		//map1.insert(pair<string,CString>("Path",pPc->strPath));
		//
		//nBRes.push_back(map1);
		//CString str;
		//str.Format(_T("%s"), pPc->strName);
		//AfxMessageBox(str);
	}
	else if(llType == CHECK_SECBASELINECHECK1)	// 授权安全
	{
		//CDisposeResult rst;
		m_pResult->GetResult(CHECK_SECBASELINECHECK1, lParam);
		++m_ulSecBaseLineNum;
		POSAUTHSECBSA pPc = (POSAUTHSECBSA)lParam;

		///////安全基线入库/////////
		POSAUTHSECBSA pInfo = new OSAUTHSECBSA;
		memset(pInfo, 0, sizeof(OSAUTHSECBSA));
		memcpy(pInfo, pPc, sizeof(OSAUTHSECBSA));
		m_svAuthSec.push_back(pInfo);

		//CString str;
		//str.Format(_T("授权安全 %s"),pPc->name);
		//AfxMessageBox(str);
		//AfxMessageBox(_T("1"));
	}
	else if(llType == CHECK_SECBASELINECHECK2)  // 账户安全
	{
		//CDisposeResult rst;
		m_pResult->GetResult(CHECK_SECBASELINECHECK2, lParam);
		++m_ulSecBaseLineNum;
		POSACCOUNTSECBSA pPc = (POSACCOUNTSECBSA)lParam;

		///////安全基线入库/////////
		POSACCOUNTSECBSA pInfo = new OSACCOUNTSECBSA;
		memset(pInfo, 0, sizeof(OSACCOUNTSECBSA));
		memcpy(pInfo, pPc, sizeof(OSACCOUNTSECBSA));
		m_svAccountSec.push_back(pInfo);
		//CString str;
		//str.Format(_T("%s"),pPc->name);
		//AfxMessageBox(str);
		//AfxMessageBox(_T("2"));
	}
	else if(llType == CHECK_SECBASELINECHECK3)	// 服务访问安全
	{
		//CDisposeResult rst;
		m_pResult->GetResult(CHECK_SECBASELINECHECK3, lParam);
		++m_ulSecBaseLineNum;
		POSSERVICESECBSA pPc= (POSSERVICESECBSA)lParam;
		///////安全基线入库/////////
		POSSERVICESECBSA pInfo = new OSSERVICESECBSA;
		memset(pInfo, 0, sizeof(OSSERVICESECBSA));
		memcpy(pInfo, pPc, sizeof(OSSERVICESECBSA));
		m_svSerivceSec.push_back(pInfo);

		//CString str;
		//str.Format(_T("服务访问安全 %s"),pPc->name);
		//AfxMessageBox(str);
		//AfxMessageBox(_T("3"));
	}
	else if(llType == CHECK_SECBASELINECHECK4)	// 口令安全
	{
		//CDisposeResult rst;
		m_pResult->GetResult(CHECK_SECBASELINECHECK4, lParam);
		++m_ulSecBaseLineNum;
		POSPASSWORDBSA pPc= (POSPASSWORDBSA)lParam;
		///////安全基线入库/////////
		POSPASSWORDBSA pInfo = new OSPASSWORDBSA;
		memset(pInfo, 0, sizeof(OSPASSWORDBSA));
		memcpy(pInfo, pPc, sizeof(OSPASSWORDBSA));
		m_svPassWdSec.push_back(pInfo);
		//CString str;
		//str.Format(_T("口令安全 %s"),pPc->name);
		//AfxMessageBox(str);
		//AfxMessageBox(_T("4"));
	}
	else if(llType == CHECK_SECBASELINECHECK5)	// 网络访问安全
	{
		//CDisposeResult rst;
		m_pResult->GetResult(CHECK_SECBASELINECHECK5, lParam);
		++m_ulSecBaseLineNum;
		POSNETACCCTRLBSA pPc= (POSNETACCCTRLBSA)lParam;
		///////安全基线入库/////////
		POSNETACCCTRLBSA pInfo = new OSNETACCCTRLBSA;
		memset(pInfo, 0, sizeof(OSNETACCCTRLBSA));
		memcpy(pInfo, pPc, sizeof(OSNETACCCTRLBSA));
		m_svNetSec.push_back(pInfo);
		//CString str;
		//str.Format(_T("网络访问安全 %s"),pPc->name);
		//AfxMessageBox(str);
		//AfxMessageBox(_T("5"));
	}
	else if(llType == CHECK_SECBASELINECHECK6)	// 文件访问安全
	{
		//CDisposeResult rst;
		m_pResult->GetResult(CHECK_SECBASELINECHECK6, lParam);
		++m_ulSecBaseLineNum;
		POSFILEACCCTRLSECBSA pPc= (POSFILEACCCTRLSECBSA)lParam;
		///////安全基线入库/////////
		POSFILEACCCTRLSECBSA pInfo = new OSFILEACCCTRLSECBSA;
		memset(pInfo, 0, sizeof(OSFILEACCCTRLSECBSA));
		memcpy(pInfo, pPc, sizeof(OSFILEACCCTRLSECBSA));
		m_svFileSec.push_back(pInfo);
		//CString str;
		//str.Format(_T("文件访问安全 %s"),pPc->name);
		//AfxMessageBox(str);
		//AfxMessageBox(_T("6"));
	}
	else if(llType == CHECK_FILESHARE)  // 文件共享
	{
		//CDisposeResult rst;
		m_pResult->GetResult(CHECK_FILESHARE, lParam);
		++m_ulFileShareNum;
		PSHAREINFO pPc = (PSHAREINFO)lParam;

		//CString str;
		//str.Format(_T("%s"),pPc->strName);
		//AfxMessageBox(str);
	}
	else if(llType == CHECK_USBCHECK)  // USB插拔记录
	{
		//CDisposeResult rst;
		m_pResult->GetResult(CHECK_USBCHECK, lParam);
		++m_ulUSBTraceNum;
		PUSBRECORDINFO pPc = (PUSBRECORDINFO)lParam;
		
		//CString str;
		//str.Format(_T("%s"),pPc->usb_DeviceName);
		//AfxMessageBox(str);
	}

	return 0;
}

// 定时器消息 响应函数
int nTimer = 0;
int nTimer6 = 0;
int nTimer30 = 0;
int nTimerVirus = 0;
void CPage2::OnTimer(UINT_PTR nIDEvent)
{
	// TODO: Add your message handler code here and/or call default

	switch (nIDEvent)
	{
	case TIMER2ID:
	{
		TASKPROGRESS ofX;
		memset(&ofX, 0, sizeof(TASKPROGRESS));
		//int i = rand()%8;
		if (nTimer == 0)
			ofX.pszText = TEXT("采集<安全日志>结果完成,正在将结果写入文件");
		else if (nTimer == 1)
			ofX.pszText = TEXT("采集<安全日志>结果完成,正在将结果写入文件.");
		else if (nTimer == 2)
			ofX.pszText = TEXT("采集<安全日志>结果完成,正在将结果写入文件..");
		else if (nTimer == 3)
			ofX.pszText = TEXT("采集<安全日志>结果完成,正在将结果写入文件...");

		ofX.nProgress = 80;
		SetContentText(&ofX);

		nTimer++;
		if (nTimer == 4)
			nTimer = 0;
	}
	break;
	case TIMER81ID:
	{
		TASKPROGRESS ofX;
		memset(&ofX, 0, sizeof(TASKPROGRESS));

		if (nTimer6 == 0)
			ofX.pszText = TEXT("开始传送<安全日志>结果");
		else if (nTimer6 == 1)
			ofX.pszText = TEXT("开始传送<安全日志>结果.");
		else if (nTimer6 == 2)
			ofX.pszText = TEXT("开始传送<安全日志>结果..");
		else if (nTimer6 == 3)
			ofX.pszText = TEXT("开始传送<安全日志>结果...");
		ofX.nProgress = 1;
		SetContentText(&ofX);

		nTimer6++;
		if (nTimer6 == 4)
			nTimer6 = 0;
	}
	break;
	case TIMERID30:
	{
		TASKPROGRESS ofX;
		memset(&ofX, 0, sizeof(TASKPROGRESS));

		if (nTimer30 == 0)
			ofX.pszText = TEXT("正在进行结果分析,请稍候");
		else if (nTimer30 == 1)
			ofX.pszText = TEXT("正在进行结果分析,请稍候.");
		else if (nTimer30 == 2)
			ofX.pszText = TEXT("正在进行结果分析,请稍候..");
		else if (nTimer30 == 3)
			ofX.pszText = TEXT("正在进行结果分析,请稍候...");
		ofX.nProgress = 1;
		SetContentText(&ofX);
		nTimer30++;
		if (nTimer30 == 4)
			nTimer30 = 0;
		break;
	}

	}

	CWnd::OnTimer(nIDEvent);
}
